import request from '@/network/request.js';

// 获取地址列表接口  /api/leju/front/address/list  get  参数: userId

function getAddressList(data) {
	return request({
		url: '/api/leju/front/address/list',
		method: 'get',
		data
	})
}

// 新增地址 post /api/leju/front/address/save  post

function getSaveAddress(data) {
	return request({
		url: '/api/leju/front/address/save',
		data,
		method: 'post',
		header: {
			'content-type': 'application/x-www-form-urlencoded'
		}
	})
}

//修改地址 post /api/leju/front/address/update 

function getUpdateAddress(data) {
	return request({
		url: '/api/leju/front/address/update',
		data,
		method: 'post',
		header: {
			'content-type': 'application/x-www-form-urlencoded'
		}
	})
}

// 删除地址 get /api/leju/front/address/del  参数 id
 
 function getDelAddress(data) {
	 return request({
		 url: '/api/leju/front/address/del',
		 data,
		 method: 'get'
	 })
 }
 
 // 地址明细 get  /api/leju/front/address/detail 参数id

function getAddressDetail(data) {
	return request({
		url: '/api/leju/front/address/detail',
		data,
		method: 'get'
	})
}

// 设置默认 get  /api/leju/front/address/setOne  参数 地址id, userId

function getAddressSetOne(data) {
	return request({
		url: '/api/leju/front/address/setOne',
		data,
		method: 'get'
	})
}

export {
	getAddressList, //获取地址列表接口
	getSaveAddress, //新增地址
	getUpdateAddress, //修改地址
	getDelAddress, //删除地址
	getAddressDetail, //地址明细
	getAddressSetOne  //设置默认
}